using System;
using MarioArena.Launcher;
using System.Windows.Forms;
using MarioArena.Multiplayer.TCP;

namespace MarioArena
{
#if WINDOWS || XBOX
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LauncherForm launcher = new LauncherForm();
            TCPConnection.Instance.Launcher = launcher;

            //Check if the application has been started with arguments. 
            //If so, the Launcher will deal with them by automatically connecting to the given server.
            bool gameStartedWithArguments = launcher.ProcessArguments(args);
            if (gameStartedWithArguments)
                Console.WriteLine("Started with arguments.");
            else Console.WriteLine("Started without or with wrong (amount of) arguments");

            if (launcher.ShowDialog() == DialogResult.OK)
            {
                using (Game1 game = new Game1())
                {
                    game.Run();
                }
            }
        }
    }
#endif
}

